package utils
{
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	import view.components.UIComponents;
	
	public class TextTool
	{
		public static function getTextField(width:int,height:int,size:int,color:int,selectable:Boolean = false,
											bold:Boolean = false,align:String = "left",indent:int=0):TextField
		{
			var textField:TextField = new TextField();
			var textFormat:TextFormat = new TextFormat();
			textField.selectable = selectable;
			textField.width = width;
			textField.height = height;
			textFormat.color = color;
			textFormat.size = size;
			textFormat.align = align;
			textFormat.bold = bold;
			textFormat.font = "Arial";
			textFormat.indent = indent;
			textField.defaultTextFormat = textFormat;
			
			return textField;
		}
		
		public static function getTextFieldXY(x:int,y:int,width:int,height:int,size:int,color:int,
											content:String,selectable:Boolean = false,bold:Boolean = false,align:String = "left"):TextField
		{
			var textField:TextField = getTextField(width,height,size,color,selectable,bold,align);
			textField.x = x;
			textField.y = y;
			
			textField.text = content;
			return textField;
		}
		
		public static function getTextArea(width:int,height:int,editable:Boolean = false):*
		{
			var textArea:* = UIComponents.getTextArea();
			textArea.width = width;
			textArea.height = height;
			textArea.editable = editable;
			textArea.textField.defaultTextFormat.align = "left";
			//textArea.textField.selectable = true;
			//textArea.textField.type = TextFieldType.DYNAMIC;
			return textArea;
		}
	}
}